package Matrixmultiply;

import java.util.concurrent.CountDownLatch;

public class Parallelthread extends Thread {
	private double[][] matrix1;
	private double[][] matrix2;
	private int index;
	private int gap;
	private double[][] resultmatrix;

	public Parallelthread(double[][] matrix1, double[][] matrix2, double[][] resultmatrix, int index, int gap
			) {
		this.matrix1 = matrix1;
		this.matrix2 = matrix2;
		this.index = index;
		this.gap = gap;
		this.resultmatrix = resultmatrix;
	}

	public void run() {
		for (int i = index * gap; i < (index + 1) * gap&&i<matrix1.length; i++) {
			for (int j = 0; j < matrix2[0].length; j++) {
				for (int k = 0; k < matrix2.length; k++)
					resultmatrix[i][j] += matrix1[i][k] * matrix2[k][j];
			}
		}
	}
}
